package impl

import (
	"context"
	"github.com/starmotioncf/soutchatinternal/model"
	"github.com/starmotioncf/soutchatinternal/repository"
)

type userRepository struct {
	*repository.Repository
}

func NewUserRepository(r *repository.Repository) repository.UserRepository {
	return &userRepository{
		Repository: r,
	}
}

func (r *userRepository) Get(ctx context.Context, uid uint64) (m *model.User, err error) {
	err = r.DB(ctx).Where("uid = ?", uid).Find(&m).Error
	return
}

func (r *userRepository) Create(ctx context.Context, m *model.User) (err error) {
	err = r.DB(ctx).Create(m).Error
	return
}
